package com.zlq.cn.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 绑定用户
 * </p>
 *
 * @author zhoucl
 * @since 2020-08-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("z_bind_user")
public class BindUser extends Model<BindUser> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 谁绑定的
     */
    private Integer fromUserId;

    /**
     * 绑定的谁
     */
    private Integer toUserId;

    /**
     * 称谓
     */
    private String remark;

    /**
     * 自定义头像
     */
    private String avatar;

    /**
     * 称谓
     */
    private String labelName;

    /**
     * 称谓id
     */
    private Integer labelId;

    /**
     * 低电量提醒；1：提醒，0：不提醒
     */
    private Integer batteryWarning;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    private LocalDateTime updateTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public boolean openBatteryWarning() {
        return batteryWarning != null && 1 == batteryWarning;
    }
}
